const app = getApp()
var that;
var util = require('../../utils/util.js');
Page({
  /* 页面的初始数据 */
  data: {
    userinfo: ''
  },

  /* 生命周期函数--监听页面加载 */
  onLoad: function (options) {
    that = this
    that.setData({
      userinfo: app.globalData.loginUserObj
    })
  },
  downloadJD:function(){
    that=this
    wx.getImageInfo({
      src: that.data.userinfo.ydCompany.logo,
      success: function (res) {
        var path = res.path;
        wx.saveImageToPhotosAlbum({
          filePath: path,
          success: function (res) {
            wx.showToast({
              title: '已保存',
            })
          },
          fail: function (res) {
            console.log('保存失败');
            wx.showModal({
              title: '提示',
              content: '“链会议Plus”申请获取保存到相册权限',
              success(res) {
                if (res.confirm) {
                  console.log('用户点击确定')
                  wx.openSetting({
                    success(res) {
                      console.log('openSetting', res)
                    }, fail(err) {
                      console.log('openSetting', err)
                    }
                  })
                } else if (res.cancel) {
                  console.log('用户点击取消')
                }
              }
            })
          }
        })
      }
    })
  }
})